package com.wtwd.campus.dao;

import com.wtwd.campus.entity.CommandRecord;
import com.wtwd.campus.entity.DeviceClassMode;
import com.wtwd.campus.entity.DeviceClassPattern;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;

/**
 * @author mjy
 * @date 2021/06/24
 * @description
 */
@Mapper
public interface DeviceClassPatternMapper {
    List<DeviceClassPattern> getDeviceClassPatternsByDeviceId(@Param("deviceId") Integer deviceId);

    DeviceClassPattern getDeviceClassPatternsById(@Param("id") Integer id);

    Integer updateClassPattern(@Param("classPattern") DeviceClassPattern classPattern);

    Integer deleteDeviceClassesPatternById(@Param("id") Integer id);

    Integer deleteDeviceClassesPatternByCommandNumber(@Param("commandNumber") String commandNumber);

    Integer batchAddClassesPattern(@Param("list")ArrayList<DeviceClassMode> batchAddList);

    Integer batchUpdateClassesPattern(@Param("list") ArrayList<DeviceClassMode> batchUpdateList);


    Integer delClassPattern(@Param("deviceId") Integer deviceId, @Param("sequence") Integer sequence);

    Integer updateClassPatternStatus(@Param("deviceId") Integer deviceId,@Param("sequence") Integer sequence, @Param("start") int start);

    /**
     * 添加设备课堂模式
     *
     * @param deviceClassMode
     * @return
     */
    int addDeviceClassPattern(DeviceClassMode deviceClassMode);


    /**
     * 修改课堂模式状态
     * @param commandNumber
     * @return
     */
    int updateDeviceClassPatternStatusById(@Param("id") Integer id, @Param("status") Integer status,@Param("commandNumber") String commandNumber);

    /**
     * 修改课堂模式状态
     * @param commandNumber
     * @return
     */
    int updateDeviceClassPatternStatus(@Param("deviceId") Integer deviceId, @Param("sequence") Integer sequence,
                                       @Param("status") Integer status, @Param("commandNumber") String commandNumber);

    List<DeviceClassMode> getDeviceClassPatternsByDeviceIdAndStatus(@Param("deviceId") Integer deviceId, @Param("status") Integer status);

    Integer batchUpdateClassesPatternState(@Param("list") ArrayList<DeviceClassMode> list);



    /**
     * 获取设备课堂模式
     * @param deviceId
     * @param sequence
     * @return
     */
    DeviceClassPattern getClassPatternByDeviceIdAndSequence(@Param("deviceId") Integer deviceId, @Param("sequence") Integer sequence);

    /**
     * 修改设备课堂模式
     * @param deviceId
     * @param sequence
     * @param beginTime
     * @param endTime
     * @param repeatTime
     * @param commandNumber
     * @param status
     * @return
     */
    int updateDeviceClassMode(@Param("deviceId") Integer deviceId, @Param("sequence") Integer sequence, @Param("beginTime") String beginTime,
                              @Param("endTime") String endTime, @Param("repeatTime") String repeatTime,
                              @Param("commandNumber") String commandNumber, @Param("status") Integer status);

    Integer delDeviceAllClassesPatternByDeviceId(@Param("deviceId") Integer deviceId);
}
